package com.bw.mallshop.adapter;

import android.widget.ImageView;
import android.widget.RadioButton;

import com.bumptech.glide.Glide;
import com.bw.common.network.LoadImag;
import com.bw.mallshop.R;
import com.bw.mallshop.entity.CarListEntity;
import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.viewholder.BaseViewHolder;

import org.jetbrains.annotations.NotNull;

public class CarListAdapter extends BaseQuickAdapter<CarListEntity.Values, BaseViewHolder> {

    public CarListAdapter() {
        super(R.layout.item_car);
        addChildClickViewIds(R.id.car_item_radio,R.id.car_item_left,R.id.car_item_right);
    }

    @Override
    protected void convert(@NotNull BaseViewHolder baseViewHolder, CarListEntity.Values values) {
        ImageView imageView = baseViewHolder.getView(R.id.car_item_img);
        LoadImag.loadMatchImg(imageView,values.goods_icon);
        baseViewHolder.setText(R.id.car_item_title,values.goods_sku);
        baseViewHolder.setText(R.id.car_item_dec,values.goods_desc);
        baseViewHolder.setText(R.id.car_item_price,values.goods_price);
        baseViewHolder.setText(R.id.car_item_num,""+values.goods_count);
        RadioButton car_item_radio = baseViewHolder.getView(R.id.car_item_radio);
        car_item_radio.setChecked(values.selFlag);
    }
}
